/*
 * Title:        CloudScheduler Toolkit
 * Description:  a Toolkit for Modeling and Simulation of Job Scheduling and Resource Provisioning in Cloud System
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 * Author:       Fuhui Wu
 *
 * Copyright (c) 2013-2014, The National University of Defense Technology, China
 */

package org.nudt.jCloud.infrastructure;

public class SlotType {
	private int peCount;
	private int ram;
	private int bw;
	private int storage;
	
	public SlotType(int peCount, int ram, int bw, int storage){
		setPeCount(peCount);
		setRam(ram);
		setBw(bw);
		setStorage(storage);
	}
	
	/**
	 * create a Slot from this SlotType as request slot. 
	 * The request will be satisfied when a host provides this slot.
	 * @return
	 */
	public Slot create(){
		return new Slot(null, null, ram, bw, storage);
	}
	
	@Override
	public int hashCode(){
		return (peCount+ram+bw+storage);
	}
	
	@Override
	public boolean equals(Object o){
		if(o == null){
			return false;
		}
		if(!(o instanceof SlotType)){
			return false;
		}
		SlotType slotType = (SlotType)o;
		if(this.peCount==slotType.getPeCount() && this.ram==slotType.getRam() && this.bw==slotType.getBw() && 
				this.storage == slotType.getStorage()){
			return true;
		}else{
			return false;
		}
	}
	
	public int getPeCount() {
		return peCount;
	}
	public void setPeCount(int peCount) {
		this.peCount = peCount;
	}
	public int getRam() {
		return ram;
	}
	public void setRam(int ram) {
		this.ram = ram;
	}
	public int getBw() {
		return bw;
	}
	public void setBw(int bw) {
		this.bw = bw;
	}
	public int getStorage() {
		return storage;
	}
	public void setStorage(int storage) {
		this.storage = storage;
	}

}
